// src/components/SensorList.tsx
import { Col, Row } from 'antd';
import React from 'react';
import Sensor from './Sensor';

interface SensorListProps {
  sensors: {
    type: 'temperature' | 'humidity' | 'light' | 'airQuality';
    interval: number;
  }[];
  sendData: (
    type: 'temperature' | 'humidity' | 'light' | 'airQuality',
    data: string,
  ) => void;
}

const SensorList: React.FC<SensorListProps> = ({ sensors, sendData }) => {
  return (
    <div>
      <Row gutter={[16, 16]}>
        {sensors.map((sensor, index) => (
          <Col key={index} span={8}>
            <Sensor
              type={sensor.type}
              interval={sensor.interval}
              sendData={sendData}
            />
          </Col>
        ))}
      </Row>
    </div>
  );
};

export default SensorList;
